package com.suarte.core;

import com.suarte.utils.Persistent;
import org.appfuse.model.BaseObject;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
 * @date   Sep 14, 2011
 * @author ggutierrez
 */

@Entity
@Table(name = "sa_companies")
public class Bank extends BaseObject implements Persistent{
    private Long id;
    private String name;

    public Bank() {
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "COMPANY_SEQ")
    @SequenceGenerator(name = "COMPANY_SEQ", sequenceName = "COMPANY_SEQ", allocationSize = 1)
    public Long getId() {
        return id;
    }

    @Column(name = "name", length = 150)
    public String getName() {
        return name;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if (!(other instanceof Bank)) {
            return false;
        }
        Bank _i = (Bank) other;
        return id.equals(_i.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
